<%-- 
    Document   : DailyReport
    Created on : Apr 10, 2015, 11:57:31 AM
    Author     : user
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
      
        <title>Daily report</title>
        <!-- 

	Copyright 2009 Itamar Arjuan
	jsDatePick is distributed under the terms of the GNU General Public License.
	
	****************************************************************************************

	Copy paste these 2 lines of code to every page you want the calendar to be available at
-->
<link rel="stylesheet" type="text/css" media="all" href="js/jsdatepick-calendar(1)/jsDatePick_ltr.min.css" />
<!-- 
	OR if you want to use the calendar in a right-to-left website
	just use the other CSS file instead and don't forget to switch g_jsDatePickDirectionality variable to "rtl"!
	
	<link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.css" />
-->
<script type="text/javascript" src="js/jsdatepick-calendar(1)/jsDatePick.min.1.3.js"></script>
<!-- 
	After you copied those 2 lines of code , make sure you take also the files into the same folder :-)
    Next step will be to set the appropriate statement to "start-up" the calendar on the needed HTML element.
    
    The first example of Javascript snippet is for the most basic use , as a popup calendar
    for a text field input.
-->
<script type="text/javascript">
	window.onload = function(){
		new JsDatePick({
			useMode:2,
			target:"inputField",
			dateFormat:"%Y-%m-%d"
			/*selectedDate:{				This is an example of what the full configuration offers.
				day:5,						For full documentation about these settings please see the full version of the code.
				month:9,
				year:2006
			},
			yearsRange:[1978,2020],
			limitToToday:false,
			cellColorScheme:"beige",
			dateFormat:"%m-%d-%Y",
			imgPath:"img/",
			weekStartDay:1*/
		});
	};
        
        	
</script>


        
        
    </head>
    <%@include file="AdminHeader.jsp"%>
    <body>
        <h1>Daily Report</h1>
        <form method="post" name="report">
        
   Start Date :<input type="text" size="12" id="inputField" name="start"/>               End Date :<input type="text" size="12" id="inputField1" name="end" /> 
    
  
   <input type="submit" value="View Report"/>
   </form>
   
   <%
    String startDate=request.getParameter("start");
    String endDate=request.getParameter("end");
    if(startDate!=null&&endDate!=null)
    {
    String query="SELECT * FROM iorder WHERE o_date  BETWEEN '"+startDate+"'AND '"+endDate+"'";
    
    Connection con=ConnectionFactory.getConnection();
    Statement st=con.createStatement();
    
    ResultSet rs=st.executeQuery(query);
    
out.println("<table width='100%'>"); 
out.println("<th>S.no</th>");
out.println("<th>Order Id</th>");
out.println("<th>Customer Email</th>");
out.println("<th>Product Id</th>");
out.println("<th>Quantity</th>");
out.println("<th>Price </th>");
out.println("<th>Delivery </th>");
out.println("<th>Order_Date </th>");
out.println("<tr></tr><tr></tr>");
int count=0;
Double tot_price=0.0;
boolean norecordFlag=true;
    while(rs.next())
    {   
        norecordFlag=false;
       tot_price +=Double.parseDouble(rs.getString("price"));
       
        out.print("<tr>");
        out.println("<td align='center'>"+(++count)+" </td>");
        out.println("<td align='center'>"+rs.getString("orderid") +" </td>");
        out.println("<td align='center'>"+rs.getString("customerName") +" </td>");
        out.println("<td align='center'>Product "+rs.getString("product") +" </td>");
        out.println("<td align='center'>"+rs.getString("quantity") +" </td>");
        out.println("<td align='center'>"+rs.getString("price") +" </td>");
        out.println("<td align='center'>"+rs.getString("delivery") +" </td>");
        out.println("<td align='center'>"+rs.getString("o_date") +" </td>");
        out.print("</tr>");
   
    }

if(norecordFlag)
       {
    out.println("No records found on these days!!!!!!");
}
out.println("</table>");
out.println("Total No of records in this page is :"+count);
out.println("<br/>");
out.println("Total price for this records is :"+tot_price);
    }
%>
        
        
    </body>
</html>
